package com.yiwei.zxp.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.yiwei.zxp.R;
import com.yiwei.zxp.api.model.ExpressCheckModel;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by xsooy-pc on 2017/10/23.
 */

public class LogisticsAdapter extends ItemAdapter<ExpressCheckModel.DatasBean.ResultBean, LogisticsAdapter.DefaultHolder> {


    public LogisticsAdapter(Context context) {
        super(context);
    }

    @Override
    public DefaultHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DefaultHolder(inflate(R.layout.item_logistics, parent));
    }

    @Override
    public void onBindViewHolder(DefaultHolder holder, int position) {
        ExpressCheckModel.DatasBean.ResultBean item = getItem(position);
        if (position == 0) {
            holder.txtTitle.setTextColor(0xff4CD127);
            holder.txtTime.setTextColor(0xff4CD127);
            holder.imgStatus.setSelected(true);
        } else {
            holder.txtTitle.setTextColor(0xff999999);
            holder.txtTime.setTextColor(0xff999999);
            holder.imgStatus.setSelected(false);
        }
        holder.txtTime.setText(item.time);
        holder.txtTitle.setText(item.status);
    }

    class DefaultHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.img_status)
        ImageView imgStatus;
        @BindView(R.id.txt_title)
        TextView txtTitle;
        @BindView(R.id.txt_time)
        TextView txtTime;
        @BindView(R.id.view_bottom)
        View viewBottom;
        @BindView(R.id.view_bottom1)
        View viewBottom1;

        public DefaultHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
